import React from 'react';
import {connect} from 'dva';
import {withRouter} from 'dva/router'
import PropTypes from 'prop-types'
import {LocaleProvider,BackTop,message } from 'antd';
import zhCN from 'antd/lib/locale-provider/zh_CN';

// import classnames from 'classnames'
import {Layout} from '../components'
import './app.less'
const {Loading} = Layout
// 全局消息提示配置
message.config({
    top: 'calc(50% - 20px)',
    duration: 3,
    maxCount: 3,
  });
function App({children, dispatch, loading,location, history}) {
    const isLoading=loading.global;
    const navProps={
        history
    }
    return (
        <LocaleProvider locale={zhCN}>
            <div className="app">
                <BackTop visibilityHeight={200}/>
                <Loading tag={isLoading}/>
                <div className="main">
                    <div className="container">
                        {children}
                    </div>
                </div>
            </div>
        </LocaleProvider>
    );
}

App.propTypes = {
    children: PropTypes.element.isRequired,
    app: PropTypes.object
};

export default withRouter(connect(({loading})=>({loading}))(App))
